<%@include file="/WEB-INF/templates/configuration.jsp" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>


<h2>${pageTitle}</h2>
<p>${topicBody}</p>
<c:choose>
    <c:when test="${aantalForumThreads != 0}">
        <!-- Wanneer er forums opgeslagen zijn, worden ze hier getoond -->
        <table class="zebra">
            <!-- Child topics  --> 
            <tr>
                <th>
                    <strong>Topics</strong>
                </th>
                <th>
                    <strong></strong>
                </th>
                <th>
                </th>
            </tr>
            <c:forEach var="topic" items="${topics}">
                <tr>

                    <td width="120px;">
                        <a href="${url}forum/topic_view?topic_id=${topic.forumtopicid}">${topic.forumtopicname}</a>
                    </td>
                    <td>
                        ${topic.forumtopicbody}
                    </td>
                    <td width="120px;">
                        <a class="icon view" href="${url}forum/topic_view?topic_id=${topic.forumtopicid}">${topic.forumtopicname}</a>
                    </td>
                </tr>
            </c:forEach>
              
            <!-- Child threads  -->
            <tr>
                <th>
                    <strong>Threads</strong>
                </th>
                <th>
                    <strong></strong>
                </th>
                <th>
                </th>

            </tr>
            <c:forEach var="threads" items="${threads}">
                <!-- Per forum wordt nu een rij aangemaakt met daarin zijn gegevens -->
                <tr>
                    <td width="120px;">
                        <a href="${url}forum/thread_view?thread_id=${threads.forumThreadId}">${threads.forumThreadName}</a>
                    </td>
                    <td>
                        ${threads.forumThreadBody}
                    </td>
                    <td>
                        <a class="icon view" href="${url}forum/thread_view?thread_id=${threads.forumThreadId}">${threads.forumThreadName}</a>
                    </td>
                    
                </tr>
            </c:forEach>
        </table>
    </c:when>
    <c:otherwise>
        <!-- Als er geen gebruikers zijn, wordt deze melding getoond -->
        There are no threads or topics found in this topic.
    </c:otherwise>
</c:choose>
<p>
    <a class="button" href="${url}forum/topic_add?parenttopic_id=${parentTopic}">Start new topic here</a>
</p>
<p>
    <a class="button" href="${url}forum/thread_add?parenttopic_id=${parentTopic}">Start new thread here</a>
</p>
<p>
    <a class="button" href="${url}index">Go back to the course</a>
</p>